#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    getline(cin, s);
    int pos = s.find_last_of(' ');
    cout << s.size() - 1 - pos;
}